package com.niit.search.controller;

import com.niit.chat.common.Result;
import com.niit.search.entity.Activity;
import com.niit.search.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 话题相关动态控制器
 * 提供根据话题ID查询相关动态的接口
 */
@RestController
@RequestMapping("/search/topic-activities")
public class TopicActivityController {

    @Autowired
    private ActivityService activityService;

    /**
     * 根据话题ID查询相关动态
     * @param topicId 话题ID
     * @return 相关动态列表
     */
    @GetMapping("/{topicId}")
    public Result<List<Activity>> getActivitiesByTopicId(@PathVariable Long topicId) {
        List<Activity> activities = activityService.findActivitiesByTopicId(topicId);
        return Result.success(activities);
    }
}